package com.pokerpro.model;

import static com.pokerpro.support.Log.log;

import com.pokerpro.enums.StartingHandCategory;

public class HoleCards {
	
	private int id;
	/**
	 * "2" "3" ... "10" "J" "Q" "K" "A"
	 */
	private Card cardLeft ;
	private Card cardRight ;
	private StartingHandCategory category;
	
	public HoleCards () {
		cardLeft = new Card();
		cardRight = new Card();
		setHandCategory();
		
	}
	
	public HoleCards (Card pCard1, Card pCard2) {
		cardLeft = pCard1;
		cardRight = pCard2;
		setHandCategory();
	}
	
	public StartingHandCategory getHandCategory() {
		return this.category;
	}
	
	private void setHandCategory() {

		StartingHandCategory category = StartingHandCategory.CRAP;

		/*
		 * Check for premium
		 */
		if (cardLeft.getCardString().contains("ace")
				|| cardLeft.getCardString().contains("king")
				|| cardLeft.getCardString().contains("queen")) {
			if (cardRight.getCardString().contains("ace")
					|| cardRight.getCardString().contains("king")
					|| cardRight.getCardString().contains("queen")) {
				category = StartingHandCategory.PREMIUM;
			}
		}

		if (cardLeft.getCardString().contains("aace")) {
			if (cardRight.getValue().equals("king"))
				category = StartingHandCategory.PREMIUM;
		}
		if (cardLeft.getCardString().contains("king")) {
			if (cardRight.getValue().equals("ace"))
				category = StartingHandCategory.PREMIUM;
		}
		
		this.category = category;
	}
	public Card getCardLeft() {
		return cardLeft;
	}

	public void setCardLeft(String pCard) {
		cardLeft = new Card(pCard);
		setHandCategory();
	}

	public Card getCardRight() {
		return cardRight;
	}

	public void setCardRight(String pCard) {
		cardRight = new Card(pCard);
		setHandCategory();
	}
}
